package com.theatre.userservice.model.dto;

import com.theatre.userservice.model.entity.ScriptCategory;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
import java.time.LocalDateTime;

@Data
@Builder
public class ScriptCategoryDTO {

    @Schema(description = "分类ID")
    private Long id;

    @Schema(description = "分类名称")
    private String name;

    @Schema(description = "分类描述")
    private String description;

    public static ScriptCategoryDTO fromEntity(ScriptCategory scriptCategory) {
        return ScriptCategoryDTO.builder()
                .id(scriptCategory.getId())
                .name(scriptCategory.getName())
                .description(scriptCategory.getDescription())
                .build();
    }

    public ScriptCategory toEntity() {
        ScriptCategory scriptCategory = new ScriptCategory();
        scriptCategory.setId(this.getId());
        scriptCategory.setName(this.getName());
        scriptCategory.setDescription(this.getDescription());
        return scriptCategory;
    }
}
